Skip to content

)}

QuaternaryDictionary.AddValueIndex(string, Func) method

Defined in

Type: QuaternaryDictionary Namespace: ReactiveList.Reactive.Collections Assembly: ReactiveList.Reactive.dll

Applies to

net11.0, net10.0, net47, net471, net472, net48, net481

public void AddValueIndex<TIndexKey>(string indexName, Func<TValue, TIndexKey> keySelector) where TIndexKey : notnull

View source (opens in a new tab)

Summary: Adds a secondary index for values using the specified key selector function.

Type parameters

NameDescription
TIndexKeyThe type of the index key.

Parameters

NameTypeDescription
indexNamestring (opens in a new tab)The unique name of the index to add.
keySelectorFunc (opens in a new tab)A function that extracts the index key from a value.

Remarks

The index is built and registered while every shard is write-locked, so no entry is missed. An existing index with the same name is replaced. If keySelector throws while the index is built, the index is not registered. If it throws later, during a mutation, the mutation is still committed and announced, the index does not hold that value, and the exception propagates to the caller after the change is complete.

Exceptions

TypeCondition
System.ArgumentNullException (opens in a new tab)indexName or keySelector is null.